<%@ page language="java" contentType="text/html; charset=US-ASCII"
	pageEncoding="US-ASCII"%>
<%@ page import="java.util.*"%>
<%@ page import="fr.esgi.classes.Promotion"%>
<%@ page import="fr.esgi.classes.Projet"%>
<%@ page import="fr.esgi.donnees.Database"%>
<%
	ArrayList <Promotion> listPromotion;
	ArrayList <Projet> listProjet;
	ArrayList <String> listPromo;
	 Database d=new Database();
	listPromo=d.afficherPromo();
	listPromotion=d.afficherPromotion();
	listProjet=d.afficherProjet();
%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Groupe creee aleatoirement</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="title" content="Web site" />
<meta name="description" content="Site description here" />
<meta name="keywords" content="keywords here" />
<meta name="language" content="en" />
<meta name="subject" content="Site subject here" />
<meta name="robots" content="All" />
<meta name="copyright" content="Your company" />
<meta name="abstract" content="Site description here" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<link id="theme" rel="stylesheet" type="text/css"
	href="../css/style.css" title="theme" />
<style type="text/css">
<%@ include file="../css/style.css"
%>
</style>

<script type="text/javascript" language="javascript"
	src="jsp/js/custom.js">
<%@ include file="../js/custom.js"%></script>
<script type="text/javascript" language="javascript"
	src="jsp/js/addon.js">
<%@ include file="../js/addon.js"%></script>
<script language="JavaScript" type="text/javascript">
			function griser(){
			var Obj = document.getElementById('groupe'); 
			Obj.innerHTML = "";
			var selectElmt = document.getElementById("promotion");
			var test=selectElmt.options[selectElmt.selectedIndex].value;
			var colPromotion=new Array();
 			var colGroupe=new Array();
   			with (document.form) {
 						<%for (int i=0; i<listPromotion.size(); i++) {%>   
   						colPromotion[<%=i%>] = "<%=listPromotion.get(i).getAnneeSpecialite()%>";   
 						colGroupe[<%=i%>] = "<%=listPromotion.get(i).getGroupe()%>";
			<%}%>
				

				for(var j=0; j < colPromotion.length; j++) {
				if (test == colPromotion[j]) {
					var opt = document.createElement("option");
			        document.getElementById("groupe").options.add(opt);
			        opt.text = colGroupe[j];
			        opt.value =colGroupe[j];
				}
				
			}
 				var colPromo=new Array();
  	 			var colGroup=new Array();
  	 			var colProjet=new Array();
  	 			var colIdprojet=new Array();
      			<%for(int j=0; j < listProjet.size(); j++){%>     
    			colPromo[<%=j%>] = "<%=listProjet.get(j).getPromotion()%>";     
   			colGroup[<%=j%>] = "<%=listProjet.get(j).getGroupe()%>"; 
  				colProjet[<%=j%>] = "<%=listProjet.get(j).getNom()%>";
  				colIdprojet[<%=j%>] = "<%=listProjet.get(j).getId()%>";
  				
  	<%}%>  
 	var Obj2 = document.getElementById('projet'); 
 	Obj2.innerHTML = "";
 	var selectElmt2 = document.getElementById("groupe");
	var groupe=selectElmt.options[selectElmt2.selectedIndex].value;
 	for ( var j = 0; j < colPromo.length; j++) {
				if (test == colPromo[j]) {
					var opt = document.createElement("option");
 					document.getElementById("projet").options.add(opt);
 					opt.text = colProjet[j];
 					opt.value = colIdprojet[j];
 				}
 			}
		}
	}
</script>
</head>
<body>
	<div id="top">
		<div class="overlay"></div>
	</div>
	<div id="wrapper">
		<div class="overlay"></div>
		<div class="border-top"></div>
		<div class="content">
			<div id="container">
				<div class="hd">
					<div id="container-top"></div>
					<div id="banner"></div>

				</div>
				<div class="bd">
					<div id="page">

						<!-- MAIN COLUMN -->
						<div id="main">
							<div class="content">
								<h1>Bienvenue !</h1>
								<body>
									<p style="margin-top: 10px;">Remplissez le formulaire
										suivant :</p>

									<form name="form" action="ValidationSoutenance" method="post">
										<p>
											Promotion<select id="promotion" name="promotion"
												onchange="griser();">
												<%
														for (int i = 0; i < listPromo.size(); i++) {
													%>
												<option value="<%out.print(listPromo.get(i));%>">
													<%
															out.println(listPromo.get(i));
														%>
												</option>
												<%
														}
													%>

											</select> Groupe <select name="groupe" id="groupe">
												<%
														for (int i = 0; i < listPromotion.size(); i++) {
															if (listPromotion.get(0).getAnneeSpecialite()
																	.equals(listPromotion.get(i).getAnneeSpecialite())) {
													%>
												<option
													value="<%out.print(listPromotion.get(i).getGroupe());%>">
													<%
															out.println(listPromotion.get(i).getGroupe());
														%>
												</option>
												<%
														}
														}
													%>
											</select> Projet <select name="projet" id="projet">
												<%
														for (int i = 0; i < listProjet.size(); i++) {
															if (listProjet.get(i).getPromotion()
																	.equals(listPromotion.get(0).getAnneeSpecialite())) {
													%>
												<option value="<%out.print(listProjet.get(i).getId());%>">
													<%
															out.print(listProjet.get(i).getNom());
														%>
												</option>
												<%
														}
														}
													%>
											</select>
										</p>

										<p>
											Ordre de passage : <input type="radio" name="ordre"
												value="automatique" checked /> Automatique <input
												type="radio" name="ordre" value="manuel" /> Manuelle
										</p>
										<p>
											Date de soutenance :<%@ include file="Calendrier.jsp"%>
										</p>
										<p>
											Horaire de d&eacute;but de soutenance : <select name="heure">
												<%
														for (int i = 8; i <= 20; i++) {
													%>
												<option>
													<%
															if (i < 10)
																	out.print("0" + i);
																else
																	out.print(i);
															}
														%>
												</option>
											</select> <select name="minute">
												<%
														for (int i = 0; i <= 59; i++) {
													%>
												<option>
													<%
															if (i < 10)
																	out.print("0" + i);
																else
																	out.print(i);
															}
														%>
												</option>
											</select>
										</p>
										<p>
											Horaire de fin de soutenance : <select name="heuref">
												<%
														for (int i = 8; i <= 20; i++) {
													%>
												<option>
													<%
															if (i < 10)
																	out.print("0" + i);
																else
																	out.print(i);
															}
														%>
												</option>
											</select> <select name="minutef">
												<%
														for (int i = 0; i <= 59; i++) {
													%>
												<option>
													<%
															if (i < 10)
																	out.print("0" + i);
																else
																	out.print(i);
															}
														%>
												</option>
											</select>
										</p>
										<p>
											Dur&eacute;e de soutenance : <select name="duree">
												<%
														for (int i = 10; i <= 30; i = i + 5) {
													%>
												<option>
													<%
															out.print(i);
															}
														%>
												</option>
											</select>min
										</p>
										<p>
										<p>
											Prise en compte de la pause : <br /> <input type="radio"
												name="pause" value="oui" /> oui <input type="radio"
												name="pause" value="non" /> non
										</p>
										</p>
										<p>
											<input type="submit" value="Valider" /> <input type="reset"
												value="Annuler" />
										</p>
									</form>
								</body>
								<%@ include file="../design/footer.jsp"%>